package maosui.model;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by wdj on 14-8-10.
 */
@Entity
@Table(name = "51lpz_online_live_queue")
public class QueueEntity {
    private int queueId;
    private int roomId;
    private int userId;
    private byte queueType;
    private Timestamp addTime;
    private Timestamp updateTime;

    @Id
    @Column(name = "queue_id", nullable = false, insertable = true, updatable = true)
    public int getQueueId() {
        return queueId;
    }

    public void setQueueId(int queueId) {
        this.queueId = queueId;
    }

    @Basic
    @Column(name = "room_id", nullable = false, insertable = true, updatable = true)
    public int getRoomId() {
        return roomId;
    }

    public void setRoomId(int roomId) {
        this.roomId = roomId;
    }

    @Basic
    @Column(name = "user_id", nullable = false, insertable = true, updatable = true)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "queue_type", nullable = false, insertable = true, updatable = true)
    public byte getQueueType() {
        return queueType;
    }

    public void setQueueType(byte queueType) {
        this.queueType = queueType;
    }

    @Basic
    @Column(name = "add_time", nullable = false, insertable = true, updatable = true)
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Basic
    @Column(name = "update_time", nullable = false, insertable = true, updatable = true)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        QueueEntity that = (QueueEntity) o;

        if (queueId != that.queueId) return false;
        if (queueType != that.queueType) return false;
        if (roomId != that.roomId) return false;
        if (userId != that.userId) return false;
        if (addTime != null ? !addTime.equals(that.addTime) : that.addTime != null) return false;
        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = queueId;
        result = 31 * result + roomId;
        result = 31 * result + userId;
        result = 31 * result + (int) queueType;
        result = 31 * result + (addTime != null ? addTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }
}
